Skip to content

diag(shell): stage 5 的 transport oracle 内部状态 (#80) - #220

Merged
JavaZeroo merged 1 commit into
mainfrom
diag/transport-probe2
Oct 30, 2026
Merged

JavaZeroo merged 1 commit into
mainfrom
diag/transport-probe2

Conversation

@JavaZeroo

Copy link
Copy Markdown
Owner

内容

为 #80 的 stage 5 超时增加 transport oracle 内部状态诊断(只读、仅失败路径):

  • local_shell_transport_probe() 复刻 oracle 的行规则,扫描 WSL 的观测窗口;
  • 写出 shells-transport-probe.jsonl:marker、output_seen、prompt_seen、malformed、last_line(转义、≤160 字符);

这样下一次超时可以直接看出是"标记行没有成为完整行"(output_seen=false)还是"没有提示符"(prompt_seen=false),不必再推断。

为什么改在诊断文件里

上一轮尝试直接改 transport_completion.hpp 失败(插入位置错误);本版把诊断放在 local_shell_diagnostics.hpp,不触碰已验证的 oracle,避免任何判据行为变化。

验证

termforge_shell 构建通过。

边界

Refs #80

… refs #80

A diagnostic-only copy of the line rules records marker, output_seen, prompt_seen, malformed and the last partial line, so the unmet condition is observed instead of inferred.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T01:03:32.962352Z e8d9d7d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8d9d7d6a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +79 to +84
} else if (kind == '[') {
while (i < raw.size() && ((raw[i] >= '0' && raw[i] <= '9') || raw[i] == ';' || raw[i] == '?')) ++i;
if (i == raw.size()) { malformed = true; break; }
++i;
} else { malformed = true; break; }
} else if (byte == '\r') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match the actual oracle when reporting transport state

The probe disagrees with transport_output_completed() on the conditions it is intended to diagnose: TF_SIZE_80x24\r\nTF> completes the oracle but reports prompt_seen=false, and TF_SIZE_80x24 followed by a column-one CUP and TF> completes the oracle but reports both flags false. Conversely, the probe silently ignores bare CRs that the oracle rejects. Consequently, a timeout caused by another readiness condition can be incorrectly attributed to missing marker output or a missing prompt. Mirror the oracle's trailing-prompt, CUP-boundary, CSI-validation and CR rules, preferably through shared parsing logic so the diagnostic state cannot diverge.

Useful? React with 👍 / 👎.

Comment on lines +102 to +103
std::snprintf(buffer, sizeof(buffer), "\\x%02x", byte);
escaped += buffer;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Encode last_line using valid JSON escapes

If the unfinished output line contains a quote, backslash or non-ASCII byte, this emits \x22, \x5c or similar sequences directly into the JSON string. JSON does not support \xNN escapes, so ordinary command text or Windows paths make the new .jsonl record unparsable; a local probe with TF>echo "C:\tmp" reproduces the failure with json.loads. Use valid JSON escaping, or JSON-escape the diagnostic hex representation before writing it.

Useful? React with 👍 / 👎.

@JavaZeroo
JavaZeroo merged commit 73438be into main Oct 30, 2026
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant